﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace HamcoWcs.DAL.Migrations
{
    public partial class A23 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "led_info");

            migrationBuilder.DropTable(
                name: "led_msg_queue");

            migrationBuilder.DropTable(
                name: "mail_msg_queues");

            migrationBuilder.DropTable(
                name: "wcs_buffer");

            migrationBuilder.AddColumn<int>(
                name: "NodeMode",
                table: "node_info",
                type: "int",
                nullable: false,
                defaultValue: 0,
                comment: "节点模式");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "NodeMode",
                table: "node_info");

            migrationBuilder.CreateTable(
                name: "led_info",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    LedIp = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Led Ip地址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LedName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Led名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    StationName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Led对应的输送机设备号")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_led_info", x => x.Id);
                },
                comment: "Led信息表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "led_msg_queue",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LedIp = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Led Ip地址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LedMsg = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false, comment: "创建时间")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LedName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Led名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SendFlag = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "已发未发标记"),
                    StationName = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "Led对应的输送机设备号")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_led_msg_queue", x => x.Id);
                },
                comment: "Led消息队列")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "mail_msg_queues",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    LastUpdateTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    Msg = table.Column<string>(type: "varchar(30)", maxLength: 30, nullable: false, comment: "消息内容")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_mail_msg_queues", x => x.Id);
                },
                comment: "邮件消息队列")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "wcs_buffer",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false, comment: "主键Id")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    BufferName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "缓存位名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MachineName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "mes设备名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PortName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "mes port名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Status = table.Column<int>(type: "int", nullable: false, defaultValue: 0, comment: "缓存位状态"),
                    UnitId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "托盘号")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_wcs_buffer", x => x.Id);
                },
                comment: "buffer位状态")
                .Annotation("MySql:CharSet", "utf8mb4");
        }
    }
}
